﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using octopus_project.scene.cannon.weapon;
using octopus_project.enumeration;

namespace octopus_project.typegame.traditionalWar {
    class TraditionalWar_Stats : Stats{
        //MINI CANNONS
        private byte nroMiniCannons = 0;
        private byte nroMediumCannons = 0;
        //private byte shots = 0;
        private Weapon weaponShooting;
        private byte indexWeapon = 0;


        public TraditionalWar_Stats() {
            weaponList = new List<Weapon>();
            
        }


        public override Damage shotting() {
            if (weaponShooting == null && weaponList.Count == 0) {
                return null;//es por si nada esta inicializado
            }
            else if (weaponShooting == null && weaponList.Count != 0) {
                weaponShooting = weaponList.ElementAt(0);//todavia nunca se disparo
                indexWeapon = 0;
            }
            Damage damage = null;

            if (weaponList.Count - 1 > indexWeapon) {

                damage = weaponShooting.shot();

                if (damage == null) {//es que no le queda mas disparo a este weapon
                    indexWeapon++;
                    weaponShooting = weaponList.ElementAt(indexWeapon);
                    damage = weaponShooting.shot();
                }
            }
            return damage;
            
        }


        public override void resetData() {
            nroMiniCannons = 0;
            nroMediumCannons = 0;
            terrainConquered = 0;
        }
        public override Weapon nextWeapon() {
            if (nroMiniCannons < 2) {
                nroMiniCannons++;
                return new MiniCannon();
            }
            else if (nroMediumCannons < 1) {
                nroMediumCannons++;
                return new MediumCannon();
            }

            return null;
        }
        
    }
}
